//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace OpenLS.Spreadsheet.UI
{
    class HorizontalCellAlignmentToHorizontalAlignmentConverter: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            HorizontalCellAlignment a = (HorizontalCellAlignment)value;
            switch (a)
            {
                case HorizontalCellAlignment.Left: return HorizontalAlignment.Left;
                case HorizontalCellAlignment.Right: return HorizontalAlignment.Right;
                case HorizontalCellAlignment.Center: 
                case HorizontalCellAlignment.CenterContinuous:
                    return HorizontalCellAlignment.Center;
                case HorizontalCellAlignment.Fill:
                case HorizontalCellAlignment.Distributed:
                case HorizontalCellAlignment.General:
                    return HorizontalAlignment.Stretch;
                default: throw new NotSupportedException();
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
